Why should I install Python packages into `~/.local`?

Posted by Matthew Rankin on Stack Overflow See other posts from Stack Overflow or by Matthew Rankin
Published on 2010-12-29T21:46:12Z Indexed on 2010/12/30 0:53 UTC
Read the original article Hit count: 143

Filed under:

Background

  1. I don't develop using OS X's system provided Python versions (on OS X 10.6 that's Python 2.5.4 and 2.6.1).
  2. I don't install anything in the site-packages directory for the OS provided versions of Python. (The only exception is Mercurial installed from a binary package, which installs two packages in the Python 2.6.1 site-packages directory.)
  3. I installed three versions of Python, all using the Mac OS X installer disk image:
    1. Python 2.6.6
    2. Python 2.7
    3. Python 3.1.2
  4. I don't like polluting the site-packages directory for my Python installations. So I only install the following five base packages in the site-packages directory. For the actual method/commands used to install these, see SO Question 4324558.
    1. setuptools/ez_setup
    2. distribute
    3. pip
    4. virtualenv
    5. virtualenvwrapper
  5. All other packages are installed in virtualenvs.
  6. I am the only user of this MacBook.

Questions

  1. Given the above background, why should I install the five base packages in ~/.local? Since I'm installing these base packages into the site-packages directories of Python distributions that I've installed, I'm isolated from the OS X's Python distributions.
  2. Using this method, should I be concerned about Glyph's comment that other things could potentially break (see his comment below)?

Again, I'm only interested in where to install those five base packages.

Related Questions/Info

I'm asking because of Glyph's comment to my answer to SO question 4314376, which stated:

NO. NEVER EVER do sudo python setup.py install whatever. Write a ~/.pydistutils.cfg that puts your pip installation into ~/.local or something. Especially files named ez_setup.py tend to suck down newer versions of things like setuptools and easy_install, which can potentially break other things on your operating system.

Previously, I asked What's the proper way to install pip, virtualenv, and distribute for Python?. However, no one answered the "why" of using ~/.local.

© Stack Overflow or respective owner

Related posts about python